﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace SevenInvaders.LEVEL_PEDRO
{
    class Power : Enemy
    {
        int kind;

        float velocity;

        Random random;

        int randomMovement;

        int trocaDePosicao;

        Boolean posicaoRandomica = true;

        public Power(Texture2D texture, Vector2 position, int kind, int amountOfEnergy)
            : base(texture)
        {
            this.kind = kind;

            velocity = 2.5f;

            this.Position = position;

            random = new Random();
        }

        public void Update(GameTime gameTime)
        {
            this.PositionY += velocity;

           

            trocaDePosicao += gameTime.TotalGameTime.Milliseconds;

            if (trocaDePosicao >= 2000)
            {

                randomMovement = random.Next(0, 3);

                if (randomMovement == 1)
                {
                    posicaoRandomica = true;
                }
                else if (randomMovement == 2)
                {
                    posicaoRandomica = false;
                }

                trocaDePosicao = 0;
            }

            if (posicaoRandomica)
            {
                this.PositionX += 5;
            }
            else if (posicaoRandomica == false)
            {
                this.PositionX -= 5;
            }

        }

        
    }
}
